package com.haidechizi.designpattern.singleton.lazy;

/**
 * @author haidechizi
 */
public class SimpleLazySingleton {

    private SimpleLazySingleton() {
    }

    private static SimpleLazySingleton hungrySingleton = null;

    // 通过synchronized保证线程安全
    public synchronized static final SimpleLazySingleton getInstance() {
        if (hungrySingleton == null) {
            hungrySingleton = new SimpleLazySingleton();
        }
        return hungrySingleton;
    }
}
